﻿namespace UnityEditorInternal
{
    using System;
    using System.Runtime.CompilerServices;
    using UnityEditor.Macros;
    using UnityEngine;
    using UnityScript.Scripting;

    public sealed class Macros
    {
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern void AddGenericMacroInstruction(string macro);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern void ClearLog();
        public static string ExecuteMacro(string macro)
        {
            string str;
            try
            {
                str = MacroEvaluator.Eval(macro);
            }
            catch (CompilationErrorsException)
            {
                Console.WriteLine("Caught exception while trying to execute this macro:");
                Console.WriteLine(macro);
                throw;
            }
            return str;
        }

        public static bool enabled { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        public static string log { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public static bool recordEvents { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }
    }
}

